﻿//using DLL.NetCore.DB.FlushRobot.MS.EFModules.Models;
using DLL.NET50.DB.MS.Entity;
using DLL.NET60.DB.MS.Entity.DTO;
using DLL.Standard.Infrastructure;
using System;
using System.Collections.Generic;
using System.Text;

namespace DLL.NET50.DB.MS.Entity.VM
{
    public class CVMDrug : CNotifyPropertyChanged
    {
        private string _DRUG_CODE;

        public string DRUG_CODE
        {
            get { return _DRUG_CODE; }
            set
            {
                if (_DRUG_CODE != value)
                {
                    _DRUG_CODE = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _DRUG_NAME;

        public string DRUG_NAME
        {
            get { return _DRUG_NAME; }
            set
            {
                if (_DRUG_NAME != value)
                {
                    _DRUG_NAME = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _SPECIFICATION;

        public string SPECIFICATION
        {
            get { return _SPECIFICATION; }
            set
            {
                if (_SPECIFICATION != value)
                {
                    _SPECIFICATION = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _MAFC_NAME;

        public string MAFC_NAME
        {
            get { return _MAFC_NAME; }
            set
            {
                if (_MAFC_NAME != value)
                {
                    _MAFC_NAME = value;
                    OnPropertyChanged();
                }
            }
        }
    }

    public class CVMDrugs : CNotifyPropertyChanged
    {
        private List<CVMDrug> _vmDrugs;

        public List<CVMDrug> vmDrugs
        {
            get { return _vmDrugs; }
            set
            {
                if (_vmDrugs != value)
                {
                    _vmDrugs = value;
                    OnPropertyChanged();
                }
            }
        }
    }

    public class VMChange
    {
        public static List<CVMDrug> GetVM(List<DTO_adi_dic_drug> entitys)
        {
            List<CVMDrug> objs = new List<CVMDrug>();
            foreach (var drug in entitys)
            {
                CVMDrug obj = new CVMDrug();
                obj.DRUG_CODE = drug.DRUG_CODE;
                obj.DRUG_NAME = drug.DRUG_NAME;
                obj.SPECIFICATION = drug.SPECIFICATION;
                obj.MAFC_NAME = drug.MAFC_NAME;
                objs.Add(obj);
            }
            return objs;
        }

        public static List<CVMDrug> GetVM(List<DTO_adi_dic_drug> entitys, int startIndex, int count)
        {
            List<CVMDrug> objs = new List<CVMDrug>();
            int Allcount = entitys.Count;
            int endIndxe = startIndex + count;
            for (int i = startIndex; i < endIndxe; i++)
            {
                if (i < Allcount)
                {
                    var drug = entitys[i];
                    CVMDrug obj = new CVMDrug();
                    obj.DRUG_CODE = drug.DRUG_CODE;
                    obj.DRUG_NAME = drug.DRUG_NAME;
                    obj.SPECIFICATION = drug.SPECIFICATION;
                    obj.MAFC_NAME = drug.MAFC_NAME;
                    objs.Add(obj);
                }
            }
            return objs;
        }
    }
}